home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI MIPSpro C Compiler 7.2
/
SGI MIPSpro C Compiler 7.2.iso
/
relnotes
/
c_fe
/
ch4.z
/
ch4
Wrap
Text File
|
1997-09-05
|
15KB
|
528 lines
- 1 -
7.2 ANSI C Front-End Release Notes
- 2 -
DDDDooooccccuuuummmmeeeennnntttt NNNNuuuummmmbbbbeeeerrrr 000000007777----1111666655559999----000011110000
4. _N_e_w__F_e_a_t_u_r_e_s__o_f__T_h_i_s__R_e_l_e_a_s_e
This chapter contains the differences between
this release and the 7.1 release of MIPSpro C
compiler.
4.1 _R_e_p_a_c_k_a_g_i_n_g__o_f__F_r_o_n_t_-_E_n_d__S_u_b_s_y_s_t_e_m_s
Under the 7.2 release, the C compiler front-end
is packaged in its own subsystem on a separate
CD. For proper installation, you must install
_c_o_m_p_i_l_e_r__d_e_v, _c_o_m_p_i_l_e_r__e_o_e and _c__d_e_v from the
IRIX Development Foundation CD as well as _c__f_e
from the MIPSpro C Compiler CD.
4.2 _N_e_w__O_p_t_i_o_n_s__a_n_d__D_e_f_a_u_l_t_s
A new -_D_E_B_U_G:_o_p_t_i_o_n control group has been
created to allow insertion of code to assist in
the debugging of programs. For example,
-_D_E_B_U_G:_d_i_v__c_h_e_c_k=_N replaces -_T_E_N_V:_c_h_e_c_k__d_i_v=_N
and the 7.2 compiler, by default, inserts code
to check for divide by zero (N=1).
_N_O_T_E: The default value for -_T_E_N_V:_c_h_e_c_k__d_i_v=_N
under MIPSpro 7.1 was N=0 (no checks).
For more information, please refer to the _c_c(1)
and _D_E_B_U_G__g_r_o_u_p(5) man pages.
The -_L_I_S_T: options control group has been
enhanced to the create a listing file (.l) that
contains the values of all flags modified,
directly in the command line, or indirectly as a
side effect of other options. For example:
% cc -n32 -LIST:options=ON foo.c
will create foo.l which contains a listing that
contains the default values of certain options
from the -OPT, -LNO, -TARG and -TENV option
control groups.
- 3 -
The following command:
% cc -n32 -LIST:all_options=ON foo.c
will create foo.l which contains a listing that
contains the default values of all options from
all of the option control groups.
For more information, please refer to the _c_c(1)
man page.
4.3 _O_b_s_o_l_e_t_e__O_p_t_i_o_n_s
Several compile-time flags have been obsoleted.
These include: -_T_E_N_V:_m_i_s_a_l_i_g_n_e_m_n_t=_N,
-_T_E_N_V:_a_l_i_g_n__e_x_t_e_r_n=_N and -_T_E_N_V:_a_l_i_g_n_e_d=_T_R_U_E.
Their use will generate a warning message in
both the compiler front-end and backend. For
example:
% cc -n32 -TENV:misalignment=3 reshape.c
Warning: Obsolete option "-TENV:misalignment=3" -- ignored
Warning: Obsolete option "-TENV:misalignment=3" -- ignored
The -_T_E_N_V:_v_a_r_a_r_g_s__p_r_o_t_o_t_y_p_e_s=_T_R_U_E flag has been
replaced by -_D_E_B_U_G:_v_a_r_a_r_g_s__p_r_o_t_o_t_y_p_e_s=_T_R_U_E.
For more information, please refer to the _c_c(1)
and _D_E_B_U_G__g_r_o_u_p(5) man pages.
4.4 _V_a_r_i_a_b_l_e__L_e_n_g_t_h__A_r_r_a_y_s
MIPSpro 7.2 now supports variable length arrays.
Array dummy arguments and local arrays can now
be declared as variable length arrays rather
than as pointers. This allows the compiler to
make assumptions about aliasing and can allow
more optimizations to be applied to code
containing references to the array. This is
particularly beneficial for parallelization.
The syntax for variable length arrays is:
- 4 -
int foo( int n, float a[n][n] ) {
float b[n]
}
In the example above, dummy argument a and local
variable b are both variable length arrays.
4.5 _F_r_e_q_u_e_n_c_y__h_i_n_t__p_r_a_g_m_a_s
MIPSpro 7.2 now supports a new pragma "#pragma
mips_freqency_hint" that is used to tell the
compiler that a branch or function is rarely or
frequently executed. The compiler uses this
information to make better optimization
decisions. A branch can be marked as infreqently
taken in this fashion:
if ( a < b ) {
#pragma mips_frequency_hint NEVER
printf("error condition0);
}
While a function can be so marked this way:
void handle_error( int i );
#pragma mips_frequency_hint NEVER handle_error
To specify that a block of code gets frequently
executed, you can use:
#pragma mips_frequency_hint FREQUENT
Frequency information about a function gets
propogated to all instances where the function
is used. So a branch that contains a call to an
infrequent function is considered infrequently
executed itself.
- 5 -
4.6 _F_i_l_l__a_n_d__A_l_i_g_n__P_r_a_g_m_a__S_u_p_p_o_r_t
MIPSpro 7.2 C supports new types of pragmas to
facilitate padding and alignment of variables
within cachelines and pages of memory. They are
outlined below.
#pragma fill_symbol (s, L1cacheline)
#pragma fill_symbol (s, L2cacheline)
#pragma fill_symbol (s, page)
#pragma fill_symbol (s, <user-specified-power-of-two>)
#pragma align_symbol (s, L1cacheline)
#pragma align_symbol (s, L2cacheline)
#pragma align_symbol (s, page)
#pragma align_symbol (s, <user-specified-power-of-two>)
The fill_symbol and align_symbol pragmas take a
symbol (i.e. a variable that may be a C global,
an automatic variable, but not a formal and not
an element of a structured type like a struct or
an array). The second argument in the pragma
may be one of the keywords L1cacheline (machine
specific first-level cache line size, typically
32 bytes), L2cacheline (machine specific
second-level cache line size, typically 128
bytes), page (machine specific page size,
typically 16 Kbytes), or a user-specified
power-of-two value.
The align_symbol pragma aligns the start of the
named symbol at the specified alignment, i.e.
the symbol "s" will start at the specified
alignment boundary.
The fill_symbol pragma pads the named symbol
with additional storage so that the symbol is
assured not to overlap with any other data item
within the storage of the specified size. The
additional padding required is heuristically
divided between each end of the specified
variable. For instance, a fill_symbol pragma for
the L1cacheline will guarantee that the
specified symbol will not suffer from false-
sharing for the L1 cache line.
For global variables these pragma must be
specified at the variable definition, and are
optional at the declarations of the variable.
- 6 -
The align_symbol pragma is ineffective for local
variables of fixed-size symbols, such as simple
scalars or arrays of known size. The pragma
continues to be effective for stack-allocated
arrays of dynamically-determined size.
A variable cannot have both fill_symbol and
align_symbol pragma applied to it.
4.7 _E_n_h_a_n_c_e_m_e_n_t__f_o_r__M_u_l_t_i_p_r_o_c_e_s_s_i_n_g
Several new enhancements related to
multiprocessing have been made to MIPSpro C 7.2:
4.7.1 _D_a_t_a__D_i_s_t_r_i_b_u_t_i_o_n__P_r_a_g_m_a_s MIPSpro 7.2 C
now supports pragmas for page-level data
distribution and dynamic redistribution. These
include _p_a_g_e__p_l_a_c_e, _d_i_s_t_r_i_b_u_t_e, _d_i_s_t_r_i_b_u_t_e
_r_e_s_h_a_p_e, _d_y_n_a_m_i_c, _r_e_d_i_s_t_r_i_b_u_t_e.
4.7.2 _O_t_h_e_r__N_e_w__M_P__P_r_a_g_m_a_s The following list
of pragmas are new for 7.2 and related to
multiprocessing: _c_o_n_c_u_r_r_e_n_t, _s_e_r_i_a_l, _c_o_n_c_u_r_r_e_n_t
_c_a_l_l, _c_o_n_c_u_r_e_n_t_i_z_e, _n_o_c_o_n_c_u_r_r_e_n_t_i_z_e, _p_r_e_f_e_r
_s_e_r_i_a_l, _p_r_e_f_e_r _c_o_n_c_u_r_r_e_n_t, _p_e_r_m_u_t_a_t_i_o_n.
The full set of pragmas supported by C are
described in the new _M_I_P_S_p_r_o _C _a_n_d _C++ _P_r_a_g_m_a_s
manual.
4.7.3 _M_P___S_L_A_V_E___S_T_A_C_K_S_I_Z_E The stacksize of
slave processes can be controlled through the
environment variable MP_SLAVE_STACKSIZE, which
may be set to the desired stacksize in bytes.
The default value is 16 Mbytes (4 MB for greater
than 64 threads).
- 7 -
4.8 _S_t_r_i_c_t_e_r__E_r_r_o_r__M_e_s_s_a_g_e
The example below would incorretly compile with
MIPSpro 7.1 without any errors. The MIPSpro 7.2
compilers will emit an error:
Example:
%cat a.c
struct st1_t;
struct st2_t {
struct st1_t st1;
};
struct st2_t st2;
main()
{
}
%cc -n32 -c a.c
"a.c", line 3: error(1070): incomplete type is not allowed
struct st1_t st1;
^
1 error detected in the compilation of "a.c".
The fix is to declare a complete type before its
use.
4.9 _S_t_r_i_c_t_e_r__W_a_r_n_i_n_g__M_e_s_s_a_g_e
The C compiler now checks the arguments with the
corresponding conversion specification in the
format strings of calls to printf(), sprintf(),
fprintf(), scanf(), fscanf, and sscanf(). This
can result in the following warning:
warning/error(1178): argument is incompatible with corresponding
format string conversion
This is normally a warning. However, it will be
reported as an error if the -_d_i_a_g__e_r_r_o_r option
is used. The fix is to use the correct
conversion character for the type of the
argument.
- 8 -
4.10 _P_R_I_N_T_F_L_I_K_E___l_i_n_t___s_t_y_l_e___c_o_m_m_e_n_t
These are lint comments for checking validity of
arguments They applies lint style check to the
first (n-1) arguments as usual. The nth argument
is interpreted as a printf format string that is
used to check the remaining arguments.
4.11 _S_C_A_N_F_L_I_K_E___l_i_n_t___s_t_y_l_e___c_o_m_m_e_n_t
This comment applies lint style check to the
first (n-1) arguments as usual. The nth argument
is interpreted as a scanf format string that is
used to check the remaining arguments.